home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 June / macformat-038.iso / Demos / Interactive Wave / _DATAS / SHARED.Dxr / 00988_Gestion de la Demo.ls < prev    next >
Encoding:
Text File  |  1995-08-06  |  3.6 KB  |  165 lines

  1. on RstDemo
  2.   global ChampsDemo
  3.   set ChampsDemo to "beep 247 278 461  FIN 1177 337 32 "
  4.   SetDcDemoRec(0)
  5.   SetDcDemo(0)
  6. end
  7.  
  8. on SetDcDemo AccuA
  9.   global DcDemo
  10.   set DcDemo to AccuA
  11. end
  12.  
  13. on GestLanceDemo
  14.   global DcDemo, CompteurDemo, AccuPosX, AccuPosY
  15.   if DcDemo = 1 then
  16.     exit
  17.   end if
  18.   if ((AccuPosX <> the mouseH) + (AccuPosY <> the mouseV)) <> 0 then
  19.     return InitCompteurDemo()
  20.   end if
  21.   if soundBusy(1) then
  22.     exit
  23.   end if
  24.   if CompteurDemo < the ticks then
  25.     LanceDemo()
  26.   end if
  27. end
  28.  
  29. on InitCompteurDemo
  30.   global CompteurDemo, AccuPosX, AccuPosY
  31.   set CompteurDemo to the ticks + (3600 * 5)
  32.   set AccuPosX to the mouseH
  33.   set AccuPosY to the mouseV
  34. end
  35.  
  36. on InitChampsDemo
  37.   global ChampsDemo
  38.   set Numero to random(8)
  39.   set ChampsDemo to the text of field ("CastDemo" & string(Numero))
  40. end
  41.  
  42. on LanceDemo
  43.   global MemoDemo, MemoNavPuce, PosChDemo
  44.   PlayClick()
  45.   set MemoDemo to MemoNavPuce
  46.   SetDcDemo(1)
  47.   InitCastRollEff()
  48.   InitChampsDemo()
  49.   WaitDown()
  50.   WaitTicks0(180)
  51.   InitCastRollEff()
  52.   set PosChDemo to 1
  53.   SetVarDemo()
  54. end
  55.  
  56. on GestDemo
  57.   global DcDemo, DelayDemo, PosMouseX, PosMouseY, FlecheDemo, MacroDemo
  58.   if DcDemo = 0 then
  59.     exit
  60.   end if
  61.   cursor(0)
  62.   if DelayDemo > the ticks then
  63.     exit
  64.   end if
  65.   set AccuA to MacroDemo
  66.   if AccuA <> "FIN" then
  67.     SetVarDemo()
  68.     do(AccuA)
  69.   else
  70.     FinDemo()
  71.     InitCompteurDemo()
  72.     LanceDemo()
  73.   end if
  74. end
  75.  
  76. on FinDemo
  77.   global MemoDemo, MemoNavPuce
  78.   SetDcDemo(0)
  79.   FalseReste()
  80.   InitCastRollEff()
  81.   set MemoNavPuce to MemoDemo
  82.   GoMovie(":NAVIG")
  83. end
  84.  
  85. on InitFlecheDemo
  86.   global FlecheDemo
  87.   set FlecheDemo to the number of cast "FlecheDemo"
  88.   PutEtatSprite(1, "48")
  89.   PutVisibSprite(1, "48")
  90.   set the ink of sprite 48 to 8
  91.   AffFlecheDemo()
  92. end
  93.  
  94. on AffFlecheDemo
  95.   global DcDemo, CastEfface, PosXDemo, PosYDemo, FlecheDemo
  96.   if DcDemo then
  97.     set the locH of sprite 48 to PosXDemo
  98.     set the locV of sprite 48 to PosYDemo
  99.     SetNomCastSprite(48, FlecheDemo)
  100.     cursor(0)
  101.     updateStage()
  102.   else
  103.     set the locV of sprite 48 to 480
  104.     SetCastSprite(48, CastEfface)
  105.     cursor(-1)
  106.   end if
  107. end
  108.  
  109. on SetVarDemo
  110.   global ChampsDemo, PosChDemo, MacroDemo, DelayDemo, PosXDemo, PosYDemo
  111.   set MacroDemo to word PosChDemo + 0 of ChampsDemo
  112.   set DelayDemo to value(word PosChDemo + 1 of ChampsDemo) + the ticks
  113.   if PosChDemo = 1 then
  114.     set PosXDemo to the mouseH
  115.     set PosYDemo to the mouseV
  116.   else
  117.     set PosXDemo to value(word PosChDemo - 2 of ChampsDemo)
  118.     set PosYDemo to value(word PosChDemo - 1 of ChampsDemo)
  119.   end if
  120.   set PosChDemo to PosChDemo + 4
  121.   AffFlecheDemo()
  122. end
  123.  
  124. on SetDcDemoRec AccuA
  125.   global DcDemoRec
  126.   set DcDemoRec to AccuA
  127. end
  128.  
  129. on GestDemoRec AccuA
  130.   global DcDemoRec, ChampsDemo, DelayDemo, DebMacRec, FinMacRec
  131.   if DcDemoRec = 0 then
  132.     exit
  133.   end if
  134.   set DebMacRec to length(ChampsDemo) + 1
  135.   set ChampsDemo to ChampsDemo & AccuA & " "
  136.   set FinMacRec to length(ChampsDemo) - 1
  137.   set ChampsDemo to ChampsDemo & string(the ticks - DelayDemo) & " "
  138.   set ChampsDemo to ChampsDemo & string(the mouseH) & " "
  139.   set ChampsDemo to ChampsDemo & string(the mouseV) & " "
  140.   set DelayDemo to the ticks
  141. end
  142.  
  143. on CorParaDemRec NomMacro
  144.   global ChampsDemo, DebMacRec, FinMacRec
  145.   set AccuA to chars(ChampsDemo, 1, DebMacRec - 1)
  146.   set AccuB to chars(ChampsDemo, FinMacRec + 1, length(ChampsDemo))
  147.   set ChampsDemo to AccuA & " " & NomMacro & " "
  148.   set FinMacRec to length(ChampsDemo) - 1
  149.   set ChampsDemo to ChampsDemo & AccuB
  150. end
  151.  
  152. on SetRecord
  153.   global ChampsDemo, DelayDemo, DcDemoRec
  154.   if DcDemoRec = 0 then
  155.     set ChampsDemo to EMPTY
  156.     set DelayDemo to the ticks
  157.     SetDcDemoRec(1)
  158.   else
  159.     GestDemoRec("FIN")
  160.     SetDcDemoRec(0)
  161.   end if
  162.   InitCastRollEff()
  163.   WaitDown()
  164. end
  165.